/* ============================================
   mobile.css - Kinmart 移动端通用增强样式
   版本: 2.0 - 响应式全面优化
   作用: 全局移动端基础优化，配合 Fadapt.css 使用
   ============================================ */

/* ===== 基础重置与优化 (768px以下) ===== */
@media (max-width: 768px) {
  * {
    box-sizing: border-box;
  }

  html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
  }

  body {
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-width: 320px;
  }

  /* 触摸优化 - 防止300ms点击延迟 */
  a, button, input[type="submit"], input[type="button"], [role="button"] {
    touch-action: manipulation;
  }

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

  /* 表格横向滚动容器 */
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 触摸目标最小 44x44px (Apple HIG / Material Design) */
  a, button, input[type="submit"], input[type="button"], input[type="text"], input[type="password"], input[type="email"], select, textarea, [role="button"], label {
    min-height: 44px;
    min-width: 44px;
  }
  /* 复选框和单选按钮除外 */
  input[type="checkbox"], input[type="radio"] {
    min-height: 20px;
    min-width: 20px;
    width: 20px;
    height: 20px;
  }

  /* 表单字体16px防止iOS缩放 */
  input[type="text"], input[type="password"], input[type="email"], input[type="number"], select, textarea {
    font-size: 16px !important;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 4px;
  }
  /* 复选框和单选按钮保持默认样式 */
  input[type="checkbox"], input[type="radio"] {
    -webkit-appearance: checkbox;
    appearance: checkbox;
  }

  /* 按钮样式统一 */
  button, input[type="submit"], input[type="button"] {
    cursor: pointer;
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 16px;
  }

  /* 隐藏PC专用 / 显示手机专用 */
  .pc-only { display: none !important; }
  .mobile-only { display: block !important; }
  .mobile-only-inline { display: inline !important; }
  .mobile-only-flex { display: flex !important; }

  /* 固定底部按钮栏 */
  .fixed-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e5e5e5;
    padding: 10px 15px;
    z-index: 1000;
    display: flex;
    justify-content: center;
    gap: 10px;
  }

  /* 步骤指示器 */
  .step-indicator {
    display: flex;
    justify-content: center;
    padding: 15px 0;
    gap: 8px;
  }
  .step-indicator span {
    padding: 6px 14px;
    border-radius: 20px;
    background: #f2f2f2;
    font-size: 12px;
    color: #666;
    white-space: nowrap;
  }
  .step-indicator span.active {
    background: rgba(192,0,0,1);
    color: #fff;
  }

  /* 卡片式布局辅助 */
  .mobile-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
  }

  /* 全宽按钮 */
  .btn-full {
    width: 100%;
    display: block;
    text-align: center;
    padding: 12px;
    font-size: 16px;
  }

  /* 弹性布局辅助 */
  .flex-col {
    display: flex;
    flex-direction: column;
  }
  .flex-wrap {
    display: flex;
    flex-wrap: wrap;
  }

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

  /* 减少动画 (尊重用户偏好) */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

/* ===== 超小屏优化 (< 480px) ===== */
@media (max-width: 480px) {
  body {
    font-size: 13px;
  }

  /* 更紧凑的间距 */
  .mobile-card {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 6px;
  }

  /* 步骤指示器更小 */
  .step-indicator span {
    padding: 4px 10px;
    font-size: 11px;
  }
  
  /* 触摸目标微调 */
  a, button, input[type="submit"], input[type="button"] {
    min-height: 40px;
    min-width: 40px;
  }
}

/* ===== 首页响应式处理 (default-page) ===== */
@media (max-width: 768px) {
  /* --- 首页主容器 --- */
  .default-page .newContent {
    flex-direction: column !important;
    padding: 0 12px;
  }
  .default-page .newContent .left,
  .default-page .newContent .left2 {
    width: 100% !important;
    padding: 0 !important;
    margin-bottom: 15px;
  }
  .default-page .newContent .right {
    width: 100% !important;
    padding: 0 !important;
  }

  /* --- 分类导航 --- */
  .default-page .newCategory {
    width: 100%;
  }
  .default-page .newCategory dl dd {
    display: none;
    position: relative;
    left: 0;
    z-index: 1;
    opacity: 1;
    border: none;
    padding-left: 20px;
    width: 100%;
  }

  /* --- 价格搜索区 --- */
  .default-page .priceSeach {
    width: 100%;
    padding: 12px;
    box-sizing: border-box;
  }
  .default-page .priceSeach select,
  .default-page .priceSeach input {
    width: 100% !important;
    margin-bottom: 8px;
  }
  .default-page .searchBtn {
    width: 100%;
    text-align: center;
    padding: 12px;
    background: transparent !important;
    color: #fff;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
  }
  .default-page .searchBtn font {
    background: #999;
    display: inline-block;
    padding: 10px 30px;
    border-radius: 4px;
  }

  /* --- Banner区域 --- */
  .default-page .indexBannerBox,
  .default-page .indexBanner {
    width: 100% !important;
    height: auto !important;
  }
  .default-page .indexBannerBox img,
  .default-page .indexBanner img {
    width: 100% !important;
    height: auto !important;
  }
  .default-page .bannerbtn {
    display: none; /* 小屏隐藏左右箭头 */
  }

  /* --- 广告区域 adbox --- */
  .default-page .adbox {
    width: 100% !important;
    padding: 12px;
    margin: 12px 0;
    box-sizing: border-box;
    flex-direction: column;
  }
  .default-page .adbox .txt {
    width: 100% !important;
    padding: 0;
  }
  .default-page .adbox .txt h3 {
    font-size: 20px;
  }
  .default-page .adbox .txt a {
    padding: 10px 20px;
    font-size: 14px;
  }
  .default-page .adbox img {
    width: 100% !important;
    height: auto !important;
  }

  /* --- 关于我们区域 --- */
  .default-page .indexAbout {
    flex-direction: column;
    padding: 0 12px;
  }
  .default-page .indexAbout .leftbox,
  .default-page .indexAbout .rightbox {
    width: 100% !important;
    padding: 0;
    margin-bottom: 20px;
  }
  .default-page .indexAbout h3 {
    font-size: 20px;
  }

  /* --- 产品轮播区域 --- */
  .default-page .indexOwlbox {
    width: 100%;
    padding: 0 12px;
    box-sizing: border-box;
  }
  .default-page .indexOwlbox .items .owlImgs a img {
    width: 100% !important;
    height: auto !important;
  }
  .default-page .indexOwlbox .name {
    font-size: 14px;
  }

  /* --- 首页内的表格兜底处理 --- */
  .default-page table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: auto;
  }
  .default-page > table > tbody > tr,
  .default-page table > tbody > tr {
    display: flex;
    flex-direction: column;
  }
  .default-page > table > tbody > tr > td,
  .default-page table > tbody > tr > td {
    display: block;
    width: 100% !important;
    height: auto !important;
    padding: 8px 0;
  }
  .default-page img {
    max-width: 100%;
    height: auto;
  }
  .default-page p {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .default-page font[size="3"] {
    font-size: 14px;
  }

  /* --- 首页第二区域 (推荐产品等，如有tab1) --- */
  .default-page #tab1 {
    width: 100% !important;
  }
  .default-page #tab1 > tbody > tr {
    display: flex;
    flex-direction: column;
  }
  .default-page #tab1 > tbody > tr > td {
    display: block;
    width: 100% !important;
    padding: 8px;
  }
  .default-page #tab1 .LeftTd {
    display: none !important;
  }
  .default-page #tab1 input[type="image"] {
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
  }
}

/* ===== 首页 480px 额外优化 ===== */
@media (max-width: 480px) {
  .default-page .adbox .txt h3 {
    font-size: 18px;
  }
  .default-page .indexAbout h3 {
    font-size: 18px;
  }
  .default-page .priceSeach {
    padding: 8px;
  }
  
  /* 产品轮播区域 - 小屏优化 */
  .default-page .indexOwlbox {
    padding: 0 8px;
  }
  .default-page .indexOwlbox .name {
    font-size: 13px;
  }
}

/* ===== ImageButton 自适应 ===== */
@media (max-width: 768px) {
  input[type="image"] {
    max-width: 100% !important;
    height: auto !important;
  }
}

/* ===== 平板端优化 (768px - 992px) ===== */
@media (min-width: 769px) and (max-width: 992px) {
  .default-page .newContent {
    padding: 0 20px;
  }
  .default-page .newContent .left2 {
    width: 30% !important;
  }
  .default-page .newContent .right {
    width: 70% !important;
  }
  
  /* 注：产品列表平板3列在 Fadapt.css 中定义 */
}

/* ===== PC端隐藏手机专用元素 ===== */
@media (min-width: 769px) {
  .mobile-only { display: none !important; }
  .mobile-only-inline { display: none !important; }
  .mobile-only-flex { display: none !important; }
}

/* ===== 导航菜单优化 ===== */
@media (max-width: 768px) {
  /* 汉堡菜单动画 */
  #moblieNav dt {
    transition: background-color 0.3s ease;
  }
  #moblieNav dt.active {
    background-color: #d45d0e;
  }
  #moblieNav dd {
    transition: all 0.3s ease;
  }
  
  /* 分类导航展开指示 */
  .myCategory dt a::after {
    content: '+';
    float: right;
    margin-right: 10px;
    font-size: 18px;
    transition: transform 0.3s ease;
  }
  .myCategory dt.expanded a::after {
    content: '-';
  }
}

/* ===== 搜索区域优化 ===== */
/* 注：搜索区域样式已在 Fadapt.css 中定义，此处保留移动端特有优化 */
@media (max-width: 480px) {
  .newHeard .newHeard-right div.nr-search button {
    font-size: 13px;
    padding: 0 4px;
  }
}

/* ===== 页脚优化 ===== */
/* 注：页脚基础样式已在 Fadapt.css 中定义，此处保留移动端特有优化 */

/* ===== 产品详情页优化 ===== */
/* 注：产品详情页基础样式已在 Fadapt.css 中定义，此处保留移动端特有优化 */
@media (max-width: 480px) {
  .newProInfo .pageLeft .sift .box2 p,
  .newProInfo .pageLeft .sift .box2 span {
    font-size: 13px !important;
  }
}

/* ===== 滚动条美化 (Webkit) ===== */
@media (max-width: 768px) {
  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  ::-webkit-scrollbar-track {
    background: #f1f1f1;
  }
  ::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
  }
}
