/* ==========================================
   base-mobile.css — 代理通移动端适配补充样式
   在 base.css 之后加载
   ========================================== */

/* ----- 移动端安全区域适配 ----- */
:root {
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* ----- 移动端底部导航栏 ----- */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 767px) {
  /* 底部导航栏显示 */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 49;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    padding-bottom: var(--safe-area-bottom);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  }
  
  .mobile-bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    color: #6b7280;
    font-size: 10px;
    text-decoration: none;
    transition: color 0.2s;
    min-height: 56px;
  }
  
  .mobile-bottom-nav a.active {
    color: #1E88E5;
  }
  
  .mobile-bottom-nav a i {
    font-size: 20px;
    margin-bottom: 2px;
  }
  
  /* 为底部导航留空间 */
  body.has-bottom-nav {
    padding-bottom: calc(60px + var(--safe-area-bottom));
  }

  /* 返回顶部按钮避开底部导航 */
  #back-to-top {
    bottom: calc(72px + var(--safe-area-bottom));
    right: 16px;
  }

  /* 主内容区底部留白 */
  main {
    padding-bottom: calc(70px + var(--safe-area-bottom)) !important;
  }

  /* 页脚在移动端增加底部间距 */
  footer {
    padding-bottom: calc(70px + var(--safe-area-bottom)) !important;
  }

  /* ----- 卡片全宽优化 ----- */
  .mobile-card-full {
    margin-left: -1rem;
    margin-right: -1rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

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

  /* ----- 按钮触摸区域优化 ----- */
  .btn, button[class*="btn"], 
  a[class*="btn"],
  .nav-link,
  .pagination a,
  .pagination button {
    min-height: 44px;
    min-width: 44px;
  }

  /* 小按钮保持灵活 */
  .btn-sm {
    min-height: 36px;
    min-width: 36px;
    padding: 0.5rem 0.75rem;
  }

  /* ----- 表单输入增大触摸区域 ----- */
  .form-input, 
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  select,
  textarea {
    min-height: 44px;
    font-size: 16px !important; /* 防止iOS缩放 */
  }

  /* ----- 分页器移动端适配 ----- */
  .pagination-mobile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.75rem 0;
  }
  
  .pagination-mobile .page-btn {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    font-size: 0.875rem;
  }
  
  .pagination-mobile .page-info {
    flex: 2;
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
  }

  /* ----- 图片响应式 ----- */
  .product-card-img {
    height: 180px !important;
    object-fit: cover !important;
  }

  /* ----- 产品详情页图片 ----- */
  .detail-main-image {
    height: 250px !important;
  }

  /* ----- 网格在超小屏上全宽 ----- */
  .grid-stack-mobile {
    grid-template-columns: 1fr !important;
  }

  /* ----- 搜索栏全宽 ----- */
  .search-form-mobile {
    flex-direction: column !important;
  }
  
  .search-form-mobile input,
  .search-form-mobile select {
    width: 100% !important;
    margin-bottom: 0.5rem;
  }
  
  .search-form-mobile button {
    width: 100% !important;
  }

  /* ----- 英雄区域文字大小调整 ----- */
  .hero-title-mobile {
    font-size: 1.5rem !important;
    line-height: 1.3 !important;
  }
  
  .hero-subtitle-mobile {
    font-size: 0.875rem !important;
  }

  /* ----- 两个按钮排列：移动端竖向堆叠 ----- */
  .btn-group-stack-mobile {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }
  
  .btn-group-stack-mobile > * {
    width: 100% !important;
  }

  /* ----- 弹窗全屏 ----- */
  .modal-mobile-full {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
  }

  /* ----- 隐藏桌面端大图 ----- */
  .hide-mobile {
    display: none !important;
  }

  /* ----- 长文本截断 ----- */
  .truncate-2-mobile {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* ----- 统计卡片2列等宽 ----- */
  .stats-grid-mobile {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ----- CKEditor内容区图片自适应 ----- */
  .ck-content img,
  .ck-editor__editable img,
  .editor-content img {
    max-width: 100% !important;
    height: auto !important;
  }

  /* ----- 表格单元格不换行优化 ----- */
  td, th {
    white-space: nowrap;
    padding: 0.5rem 0.75rem;
  }
}

/* ----- 中等屏幕(平板)优化 ----- */
@media (min-width: 768px) and (max-width: 1023px) {
  .tablet-stack {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
