/*
 * 浏览器兼容性样式
 * 仅包含兼容性修复，不影响布局
 */

/* ========================================
   基础兼容性 (所有设备)
   ======================================== */

/* Box Model 统一 */
*,
*::before,
*::after {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

/* 字体渲染优化 */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 文本选择颜色 */
::selection {
  background: rgba(53, 143, 240, 0.3);
  color: inherit;
}

::-webkit-selection {
  background: rgba(53, 143, 240, 0.3);
  color: inherit;
}

/* 图片防拖拽 */
img {
  -webkit-user-drag: none;
  user-drag: none;
}

/* 表单元素规范化 */
button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

button::-moz-focus-inner {
  border: 0;
  padding: 0;
}

/* ========================================
   移动端专用兼容性 (< 1024px)
   ======================================== */
@media screen and (max-width: 1024px) {
  /* 触摸高亮移除 */
  a,
  button,
  input,
  select,
  textarea {
    -webkit-tap-highlight-color: transparent;
  }

  /* 禁用双击缩放 */
  html {
    touch-action: manipulation;
  }

  /* 图片长按菜单禁用 */
  img {
    -webkit-touch-callout: none;
  }

  /* 滚动条隐藏 */
  .seMenu::-webkit-scrollbar,
  #banner .listBox::-webkit-scrollbar {
    display: none;
    height: 0;
  }

  .seMenu,
  #banner .listBox {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  /* iOS Safari 滚动优化 */
  .mainContent,
  .seMenu,
  #banner .listBox {
    -webkit-overflow-scrolling: touch;
  }
}

/* ========================================
   iOS Safari 专用修复
   ======================================== */
@supports (-webkit-touch-callout: none) {
  @media screen and (max-width: 1024px) {
    /* 输入框缩放修复 */
    input[type="text"],
    input[type="email"],
    input[type="search"],
    input[type="password"],
    textarea,
    select {
      font-size: 16px;
    }

    /* 安全区域适配 (刘海屏) */
    .nav {
      padding-top: env(safe-area-inset-top);
      padding-top: constant(safe-area-inset-top);
    }

    .footer {
      padding-bottom: env(safe-area-inset-bottom);
      padding-bottom: constant(safe-area-inset-bottom);
    }

    #gotoTop {
      bottom: calc(80px + env(safe-area-inset-bottom));
      bottom: calc(80px + constant(safe-area-inset-bottom));
    }

    /* position:fixed 修复 */
    .nav {
      -webkit-transform: translateZ(0);
      transform: translateZ(0);
    }
  }
}

/* ========================================
   Firefox 专用修复
   ======================================== */
@-moz-document url-prefix() {
  /* Firefox滚动条样式 */
  * {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
  }

  @media screen and (max-width: 1024px) {
    .seMenu,
    #banner .listBox {
      scrollbar-width: none;
    }
  }
}

/* ========================================
   高对比度模式
   ======================================== */
@media (prefers-contrast: high) {
  a {
    text-decoration: underline;
  }
}

/* ========================================
   减少动画模式
   ======================================== */
@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;
  }
}

/* ========================================
   打印样式
   ======================================== */
@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  img {
    max-width: 100% !important;
  }

  @page {
    margin: 2cm;
  }
}
