/* 响应式基础样式 */

/* 移除固定宽度限制，允许内容自适应 */
* {
  box-sizing: border-box;
}

/* 确保视口正确设置 */
html {
  font-size: 16px; /* 基础字体大小 */
  -webkit-text-size-adjust: 100%; /* 防止iOS自动调整字体大小 */
  -ms-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  color: #333;
  background-color: #f5f5f5;
  overflow-x: hidden; /* 防止水平滚动条 */
  touch-action: manipulation; /* 优化触摸体验 */
}

/* 确保图片响应式 */
img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  display: block;
  transition: opacity 0.3s ease;
}

/* 响应式图片容器 */
.img-container {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.img-container img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

/* 图片加载占位符 */
.img-placeholder {
  background-color: #f5f5f5;
  background-image: linear-gradient(90deg, #f0f0f0 25%, #f5f5f5 25%, #f5f5f5 50%, #f0f0f0 50%, #f0f0f0 75%, #f5f5f5 75%, #f5f5f5 100%);
  background-size: 20px 20px;
  animation: loading 1s linear infinite;
}

@keyframes loading {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 40px 0;
  }
}

/* 懒加载图片 */
.lazy-load {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lazy-load.loaded {
  opacity: 1;
}

/* 高DPI设备图片优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* 为高DPI设备提供更高质量的图片 */
  .high-dpi-optimized {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* 小屏幕设备图片优化 */
@media (max-width: 480px) {
  .mobile-optimized img {
    max-width: 100%;
    height: auto;
  }
}

/* 移除固定最小宽度 */
.header {
  min-width: auto !important;
  width: 100%;
  box-sizing: border-box;
}

/* 确保容器响应式 */
.section-container,
.header-box {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 15px;
  box-sizing: border-box;
}

/* 优化移动端点击区域 */
button, 
a, 
input[type="button"], 
input[type="submit"], 
input[type="reset"] {
  touch-action: manipulation;
  cursor: pointer;
}

/* 隐藏移动端默认的长按菜单 */
img, 
a {
  -webkit-touch-callout: none;
}

/* 禁止文本选中干扰交互 */
.no-select {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* 基础媒体查询 */
@media (max-width: 768px) {
  html {
    font-size: 15px;
  }
  
  .section-container,
  .header-box {
    padding: 0 12px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
  
  .section-container,
  .header-box {
    padding: 0 10px;
  }
}

/* 移动设备触摸反馈 */
@media (hover: none) and (pointer: coarse) {
  a, button {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  }
}

/* iOS设备兼容性样式 */
.is-ios {
  /* 修复iOS滚动问题 */
  -webkit-overflow-scrolling: touch;
}

/* iOS 13+ 特定样式 */
.ios-13-up {
  /* iOS 13+ 暗黑模式适配 */
  color-scheme: light;
}

/* Android设备兼容性样式 */
.is-android {
  /* 修复Android浏览器文本渲染 */
  -webkit-font-smoothing: antialiased;
  text-shadow: 0 0 0 rgba(0, 0, 0, 0.01);
}

/* Android 9+ 特定样式 */
.android-9-up {
  /* 优化高分辨率显示 */
  image-rendering: optimizeQuality;
}

/* 微信浏览器特定样式 */
.browser-wechat body {
  /* 修复微信浏览器中的常见问题 */
  position: relative;
}

/* 修复iOS输入框问题 */
.is-ios input, .is-ios textarea {
  -webkit-appearance: none;
  border-radius: 0;
}

/* 修复Android焦点问题 */
.is-android a:focus, .is-android button:focus {
  outline: 2px solid #0066cc;
}

/* 触摸设备优化 */
.is-mobile {
  /* 禁用双击缩放 */
  * {
    touch-action: manipulation;
  }
}

/* 优化移动端滚动性能 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}