/* 移动端响应式修复 - 解决移动设备上的显示问题 */

/* 通用响应式配置 */
@media screen and (max-width: 768px) {
  /* 修复所有页面的基本响应式布局 */
  .container {
    width: 95%;
    padding: 0 10px;
  }
  
  h1, h2 {
    word-break: break-word;
    hyphens: auto;
  }
  
  /* 修复页眉在移动设备上的显示 */
  header .container {
    padding: 25px 15px;
    flex-direction: column;
    align-items: flex-start;
  }
  
  /* 修复 Logo 在移动设备上过大的问题 */
  .logo {
    max-width: 100%;
    margin-bottom: 15px;
  }
  
  .logo {
    margin-left: -25px;
  }
  
  .logo a {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    margin-right: 10px;
  }
  
  .logo-img {
    height: 85px;
    width: auto;
    max-width: 280px;
    margin-right: 15px;
    object-fit: contain;
    filter: contrast(1.15) saturate(1.1) brightness(1.03) sharpness(1.2);
    -webkit-filter: contrast(1.15) saturate(1.1) brightness(1.03) sharpness(1.2);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
  
  .logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    white-space: normal;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    display: inline-block;
    letter-spacing: normal;
    color: #333333;
  }
  
  /* 改进导航在移动端的可点击区域 */
  nav {
    width: 100%;
    max-width: 100%;
    margin-top: 5px;
  }
  
  nav ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    padding: 0;
  }
  
  nav a {
    padding: 10px 15px;
    margin: 2px;
    min-height: 44px; /* 增加最小点击区域高度 */
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* 确保页脚在移动设备上的可读性 */
  footer {
    padding: 50px 0 20px;
  }
  
  /* 修复页面内容在移动设备上的间距 */
  section {
    padding: 50px 0;
  }
  
  /* 调整 WhatsApp 浮动按钮 */
  .whatsapp-float {
    width: 50px;
    height: 50px;
    bottom: 25px;
    right: 25px;
    font-size: 28px;
  }
  
  /* 为产品页面的图片添加更好的触摸支持 */
  .solution-image {
    min-height: 44px;
    margin-bottom: 15px;
  }
  
  /* 改进灯箱关闭按钮的可点击区域 */
  .close, .close-lightbox {
    padding: 10px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* 针对小屏幕设备的额外优化 */
@media screen and (max-width: 480px) {
  /* 进一步优化页眉在小屏幕上的显示 */
  header .container {
    padding: 15px 5px;
  }
  
  .logo-img {
    height: 78px;
    width: auto;
    max-width: 260px;
    object-fit: contain;
    filter: contrast(1.15) saturate(1.1) brightness(1.03) sharpness(1.2);
    -webkit-filter: contrast(1.15) saturate(1.1) brightness(1.03) sharpness(1.2);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
  
  .logo h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333333;
  }
  
  nav ul {
    gap: 2px;
  }
  
  nav a {
    padding: 8px 10px;
    font-size: 14px;
  }
}

/* Manufacturers 部分的专门修复 */
@media screen and (max-width: 768px) {
  /* 重写制造商网格布局，改为垂直单列布局 */
  .manufacturers-grid {
    display: grid;
    grid-template-columns: 1fr !important; /* 强制单列布局 */
    gap: 30px !important;
    width: 100% !important;
    max-width: 500px !important;
    margin: 40px auto 0 !important;
  }
  
  .manufacturer-item {
    height: auto !important;
    min-height: 200px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: row !important; /* 水平布局 */
    position: relative !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  
  .manufacturer-logo {
    width: 40% !important;
    height: 100% !important;
    min-height: 200px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 15px !important;
    position: relative !important; /* 改为相对定位 */
    top: auto !important;
    left: auto !important;
    right: auto !important;
    background: white !important;
    border-right: 2px solid var(--primary-color) !important;
  }
  
  .manufacturer-logo img {
    max-width: 85% !important;
    max-height: 85% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
  }
  
  .manufacturer-info {
    width: 60% !important;
    height: 100% !important;
    min-height: 200px !important;
    padding: 20px 15px !important;
    position: relative !important;
    background: rgba(12, 80, 62, 0.05) !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    z-index: 10 !important;
    border-top: none !important;
  }
  
  .manufacturer-info h3 {
    font-size: 16px !important;
    margin: 0 0 15px 0 !important;
    line-height: 1.3 !important;
    width: 100% !important;
    text-align: center !important;
    word-break: break-word !important;
    hyphens: auto !important;
    overflow: visible !important;
    text-overflow: initial !important;
    max-height: none !important;
    display: block !important;
    color: var(--primary-color) !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
  
  .download-buttons {
    flex-wrap: wrap !important;
    justify-content: center !important;
    max-width: 100% !important;
    width: 100% !important;
    display: flex !important;
    gap: 10px !important;
    margin-top: 10px !important;
  }
  
  .download-btn {
    margin: 0 !important;
    padding: 6px 12px !important;
    font-size: 12px !important;
    min-width: 80px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: none !important;
  }
}

/* 针对超小屏幕的额外优化 */
@media screen and (max-width: 480px) {
  /* 在更小的屏幕上调整制造商卡片布局 */
  .manufacturer-item {
    flex-direction: column !important; /* 垂直布局 */
    min-height: auto !important;
  }
  
  .manufacturer-logo {
    width: 100% !important;
    min-height: 120px !important;
    border-right: none !important;
    border-bottom: 2px solid var(--primary-color) !important;
  }
  
  .manufacturer-info {
    width: 100% !important;
    min-height: 120px !important;
    padding: 15px 10px !important;
  }
  
  .manufacturer-info h3 {
    font-size: 14px !important;
    margin: 0 0 10px 0 !important;
  }
  
  /* 修复 about 页面其他部分在小屏幕上的显示 */
  .gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .gallery-item {
    margin-bottom: 15px;
  }
  
  /* 修复其他页面元素在小屏幕上的显示 */
  .who-we-are-grid {
    display: flex;
    flex-direction: column;
  }
  
  .who-we-are-stats {
    flex-direction: column;
    margin-top: 20px;
  }
  
  .stat-box {
    width: 100%;
    margin-bottom: 15px;
  }
  
  /* 调整其他页面元素 */
  .product-grid, 
  .video-container,
  .cta .container {
    width: 95%;
  }
  
  /* 调整下载按钮区域 */
  .download-buttons {
    margin-top: 8px !important;
    gap: 5px !important;
  }
  
  .download-btn {
    padding: 4px 8px !important;
    font-size: 11px !important;
    min-width: 70px !important;
  }
  
  .download-btn i {
    font-size: 10px !important;
    margin-right: 3px !important;
  }
}

/* 为最小屏幕尺寸添加更多优化 */
@media screen and (max-width: 320px) {
  /* 特别针对超小屏幕设备的调整 */
  .logo-img {
    height: 72px;
    width: auto;
    max-width: 240px;
    object-fit: contain;
    filter: contrast(1.15) saturate(1.1) brightness(1.03) sharpness(1.2);
    -webkit-filter: contrast(1.15) saturate(1.1) brightness(1.03) sharpness(1.2);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
  
  .logo h1 {
    font-size: 0.9rem;
    font-weight: 700;
    color: #333333;
  }
  
  nav a {
    padding: 6px 8px;
    font-size: 13px;
  }
  
  .hero h1 {
    font-size: 1.8rem;
    white-space: nowrap;
    overflow: visible;
  }
  
  h2 {
    font-size: 1.5rem;
  }
}

/* 针对特定元素的高清显示屏适配 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  body, h1, h2, h3, p, a, span, li {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  
  img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
  
  /* 移动端logo特殊优化 */
  .logo-img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: optimize-contrast;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    filter: contrast(1.08) saturate(1.05) brightness(1.01);
    -webkit-filter: contrast(1.08) saturate(1.05) brightness(1.01);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }
}

/* 高分辨率设备优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  body, h1, h2, h3, p, a, span, li {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  
  img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
  
  .manufacturer-item,
  .gallery-item,
  .product-card {
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }
  
  * {
    text-rendering: optimizeLegibility;
    -webkit-tap-highlight-color: transparent;
  }
}

/* 触摸设备的表单元素优化 */
@media screen and (max-width: 768px) {
  /* 优化表单元素在触摸设备上的显示 */
  input, select, textarea, button {
    font-size: 16px !important; /* 防止iOS自动缩放 */
  }
}

/* 修复Safari中可能出现的溢出问题 */
@supports (-webkit-touch-callout: none) {
  @media screen and (max-width: 480px) {
    .manufacturer-item {
      overflow: visible !important;
    }
    
    .manufacturer-info h3 {
      display: block !important;
      white-space: normal !important;
      text-overflow: clip !important;
      overflow: visible !important;
      max-height: none !important;
      visibility: visible !important;
      opacity: 1 !important;
    }
  }
}

/* 修复iOS Safari上的特殊问题 */
@supports (-webkit-touch-callout: none) {
  /* iOS Safari 特定修复 */
  .manufacturer-item,
  .gallery-item,
  .product-card,
  nav a,
  .btn {
    cursor: pointer;
  }
  
  /* 防止iOS上的点击延迟 */
  * {
    touch-action: manipulation;
  }
}

/* 修复Android Chrome上的特殊问题 */
@supports not (-webkit-touch-callout: none) {
  @media screen and (max-width: 768px) {
    /* Android Chrome 特定修复 */
    input, select, textarea, button {
      font-size: 16px;
    }
  }
} 