/* responsive-mobile.css - Auto-split from styles.css */

/* 全局移动端修复 */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

.wrap {
  overflow-x: hidden;
}

.product-detail {
  overflow-x: hidden;
  max-width: 100vw;
}

/* 平板设备 (768px - 1024px) */
@media (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* 小平板/大手机 (640px - 768px) */
@media (max-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 8px;
  }
  
  .product-card .img img {
    border-radius: 8px;
  }
  
  .product-card .title {
    font-size: 12px;
    margin-top: 8px;
  }
  
  .product-card .desc {
    font-size: 11px;
  }
  
  .product-card .amount {
    font-size: 13px;
  }
  
  .product-card .desc.express_mark {
    font-size: 10px;
  }
}

/* 手机设备 (max-width: 640px) */
@media (max-width: 640px) {
  .wrap {
    padding: 0 12px;
  }
  
  .logo {
    padding: 12px 0;
  }
  
  .logo svg {
    width: 90px;
    height: 20px;
  }
  
  .search_hdr {
    padding: 8px 0;
  }
  
  .ipt {
    font-size: 18px;
    padding: 10px 0;
  }
  
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 8px;
  }
  
  .product-card .title {
    font-size: 11px;
    -webkit-line-clamp: 2;
  }
  
  .product-card .desc {
    font-size: 10px;
  }
  
  .product-card .amount {
    font-size: 12px;
  }
  
  .product-status {
    font-size: 10px;
    padding: 2px 5px;
    top: 4px;
    right: 4px;
  }
  
  /* 分页控制 */
  .pagination-controls {
    gap: 8px;
  }
  
  .page-btn {
    padding: 8px 16px;
    font-size: 13px;
  }
}

/* 小手机设备 (max-width: 480px) */
@media (max-width: 480px) {
  .wrap {
    padding: 0 10px;
  }
  
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 6px;
  }
  
  .product-card .img {
    border-radius: 6px;
  }
  
  .product-card .title {
    font-size: 10px;
    margin-top: 6px;
  }
  
  .product-card .desc {
    font-size: 9px;
    margin-top: 2px;
  }
  
  .product-card .amount {
    font-size: 11px;
    margin-top: 4px;
  }
  
  .product-card .desc.express_mark {
    font-size: 9px;
    margin-top: 4px;
  }
}

/* ========================================
   商品详情页移动端适配
   ======================================== */
@media (max-width: 768px) {
  .product-detail {
    padding: 12px;
    border-radius: 0;
    overflow-x: hidden;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* 返回按钮 - 防止换行 */
  .detail-header {
    padding: 4px 0;
    margin-left: -8px;
    margin-bottom: 8px;
  }
  
  .back-button {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    padding: 4px 10px 4px 6px;
    font-size: 14px;
    width: auto;
    height: auto;
  }
  
  .back-button svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }
  
  .detail-content {
    gap: 16px;
    max-width: 100%;
    overflow-x: hidden;
  }
  
  /* 左侧图片区域 */
  .detail-left {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }
  
  .image-gallery {
    width: 100%;
    max-width: 100%;
  }
  
  .main-image-container {
    border-radius: 10px;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
  }
  
  .main-image-wrapper {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1;
  }
  
  .main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .image-nav-btn {
    width: 32px;
    height: 32px;
  }
  
  .image-nav-btn svg {
    width: 18px;
    height: 18px;
  }
  
  .image-indicators {
    bottom: 8px;
    gap: 5px;
  }
  
  .image-indicator {
    width: 5px;
    height: 5px;
  }
  
  /* 同类商品 */
  .related-products-section {
    margin-top: 10px;
    padding-top: 8px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
  }
  
  .product-linked-group-list {
    gap: 4px;
    max-width: 100%;
  }
  
  .linked-group-item {
    width: 36px;
  }
  
  .linked-group-item .item-image {
    width: 36px;
    height: 36px;
    border-radius: 4px;
  }
  
  /* 右侧信息区域 */
  .detail-right {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    padding: 0;
    margin: 0;
  }
  
  .product-info {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }
  
  /* 确保所有模块宽度一致 */
  .product-details-table,
  .rating-section,
  .price-info-bar,
  .size-price-table-container,
  .settings-info-bar,
  .price-table,
  #tableDiv {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  
  .settings-info-bar {
    padding: 6px 8px !important;
    margin-bottom: 8px !important;
    justify-content: center !important;
  }
  
  .settings-info-bar > div {
    justify-content: center !important;
  }
  
  /* 隐藏整体对比放大镜（移动端每张图已有自己的放大功能） */
  .modal-compare-zoom-btn {
    display: none !important;
  }
  
  /* 价格对比表格容器 - 支持横向滚动 */
  #fullPriceTableContainer {
    padding: 10px 0 15px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  
  /* 移动端表格优化 - 缩小字体和间距 */
  #fullPriceTableContainer table {
    font-size: 9px !important;
  }
  
  #fullPriceTableContainer th,
  #fullPriceTableContainer td {
    padding: 5px 3px !important;
    font-size: 9px !important;
    white-space: nowrap;
  }
  
  /* KR码列稍宽一点 */
  #fullPriceTableContainer th:first-child,
  #fullPriceTableContainer td:first-child {
    padding: 5px 4px !important;
  }
  
  .brand-name {
    font-size: 12px;
  }
  
  .product-title {
    font-size: 15px;
    word-break: break-word;
  }
  
  .product-subtitle {
    font-size: 11px;
    word-break: break-word;
    margin-bottom: 6px;
  }
  
  /* 评分区域 */
  .rating-section {
    padding: 4px 0;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .rating-number {
    font-size: 13px;
  }
  
  .review-count,
  .wish-count,
  .transaction-count {
    font-size: 11px;
  }
  
  /* 详情表格 - 紧凑横向显示 */
  .product-details-table {
    margin-bottom: 6px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid #ebebeb;
    border-bottom: 1px solid #ebebeb;
    padding: 6px 0;
  }
  
  .details-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    white-space: nowrap;
    justify-content: flex-start;
  }
  
  .detail-item {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    padding: 0;
    min-height: auto;
    min-width: auto;
    max-width: none;
    flex: none;
  }
  
  .detail-item:not(:first-child)::before {
    content: '|';
    color: #d3d3d3;
    margin: 0 8px;
    font-size: 11px;
  }
  
  .detail-label {
    font-size: 11px;
    color: #999;
    margin-bottom: 0;
  }
  
  .detail-value {
    font-size: 11px;
    color: #222;
    max-width: none;
  }
  
  /* 价格区域 */
  .price-section {
    padding: 12px 0;
  }
  
  .price-label {
    font-size: 10px;
  }
  
  .price-amount {
    font-size: 18px;
  }
  
  .original-price {
    font-size: 11px;
  }
  
  .discount-rate {
    font-size: 14px;
  }
  
  /* 商品信息区域 */
  .detail-box {
    padding: 0;
  }
  
  .detail-title {
    font-size: 11px;
    min-width: 60px;
  }
  
  /* 尺码表格 */
  .size-price-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  
  .size-price-table {
    font-size: 10px;
    min-width: 500px;
  }
  
  .size-price-table th,
  .size-price-table td {
    padding: 6px 4px;
  }
  
  /* 底部按钮 */
  .action-buttons {
    gap: 6px;
    padding: 10px;
    flex-wrap: wrap;
  }
  
  .action-buttons button {
    padding: 10px 12px;
    font-size: 12px;
  }
  
  #fetchPriceButton {
    padding: 8px 12px;
    font-size: 11px;
  }
  
  .fetch-icon {
    font-size: 12px;
  }
}

/* 手机详情页 (max-width: 480px) */
@media (max-width: 480px) {
  .product-detail {
    padding: 10px 8px;
  }
  
  .detail-header {
    padding: 2px 0;
    margin-left: -6px;
    margin-bottom: 6px;
  }
  
  .back-button {
    padding: 3px 8px 3px 4px;
    font-size: 13px;
    gap: 2px;
  }
  
  .back-button svg {
    width: 18px;
    height: 18px;
  }
  
  .detail-content {
    gap: 12px;
  }
  
  .main-image-container {
    border-radius: 8px;
  }
  
  .image-nav-btn {
    width: 28px;
    height: 28px;
  }
  
  .linked-group-item {
    width: 32px;
  }
  
  .linked-group-item .item-image {
    width: 32px;
    height: 32px;
  }
  
  .product-title {
    font-size: 14px;
  }
  
  .product-subtitle {
    font-size: 10px;
    margin-bottom: 4px;
  }
  
  .rating-section {
    padding: 2px 0;
    margin-bottom: 4px;
    gap: 4px;
  }
  
  .rating-number {
    font-size: 12px;
  }
  
  .review-count,
  .wish-count,
  .transaction-count {
    font-size: 10px;
  }
  
  /* 详情表格 */
  .product-details-table {
    margin-bottom: 4px;
    padding: 5px 0;
  }
  
  .detail-item {
    gap: 2px;
  }
  
  .detail-item:not(:first-child)::before {
    margin: 0 6px;
    font-size: 10px;
  }
  
  .detail-label {
    font-size: 10px;
  }
  
  .detail-value {
    font-size: 10px;
  }
  
  .price-amount {
    font-size: 16px;
  }
  
  .discount-rate {
    font-size: 13px;
  }
  
  .size-price-table {
    font-size: 9px;
  }
  
  .size-price-table th,
  .size-price-table td {
    padding: 5px 3px;
  }
  
  #fetchPriceButton {
    padding: 6px 10px;
    font-size: 10px;
  }
  
  .fetch-icon {
    font-size: 11px;
  }
}

/* ========================================
   弹窗移动端适配（价格对比等）
   ======================================== */
@media (max-width: 768px) {
  #fullPriceModal .modal-content,
  .modal-content {
    width: 95% !important;
    max-width: none !important;
    margin: 10px auto !important;
    max-height: 90vh !important;
    border-radius: 12px !important;
  }
  
  #fullPriceModal h2,
  .modal-content h2 {
    font-size: 16px !important;
    padding: 12px 16px !important;
  }
  
  #fullPriceModal table,
  .modal-content table {
    font-size: 11px !important;
  }
  
  #fullPriceModal th,
  #fullPriceModal td,
  .modal-content th,
  .modal-content td {
    padding: 6px 4px !important;
  }
  
  #fullPriceModal .close-btn,
  .modal-close-btn {
    width: 32px !important;
    height: 32px !important;
    font-size: 20px !important;
  }
}

@media (max-width: 480px) {
  #fullPriceModal .modal-content,
  .modal-content {
    width: 98% !important;
    margin: 5px auto !important;
    border-radius: 8px !important;
  }
  
  #fullPriceModal h2,
  .modal-content h2 {
    font-size: 14px !important;
    padding: 10px 12px !important;
  }
  
  #fullPriceModal table,
  .modal-content table {
    font-size: 10px !important;
  }
  
  #fullPriceModal th,
  #fullPriceModal td,
  .modal-content th,
  .modal-content td {
    padding: 5px 3px !important;
  }
}

/* ========================================
   设置弹窗移动端适配
   ======================================== */
@media (max-width: 640px) {
  .settings-modal {
    padding: 12px;
  }
  
  .settings-modal-content {
    max-width: 100%;
    max-height: 92vh;
  }
  
  .settings-modal-header,
  .settings-modal-body {
    padding: 14px 16px;
  }
  
  .settings-modal-header h2 {
    font-size: 16px;
  }
  
  .settings-modal-body label {
    font-size: 12px;
  }
  
  .settings-modal-body input {
    font-size: 14px;
    padding: 10px;
  }
  
  .settings-category-list {
    max-height: 220px;
  }
  
  .settings-params-row {
    gap: 6px 10px;
  }
  
  .save-settings-button {
    padding: 12px;
    font-size: 14px;
  }
}

/* ========================================
   加载动画移动端适配
   ======================================== */
@media (max-width: 480px) {
  .search-loading {
    margin-top: 60px;
    padding: 40px 12px;
  }
  
  .loading-spinner {
    width: 40px;
    height: 40px;
  }
  
  .loading-text {
    font-size: 14px;
  }
  
  .loading-dots span {
    width: 6px;
    height: 6px;
  }
}

/* ========================================
   触摸设备优化
   ======================================== */
@media (hover: none) and (pointer: coarse) {
  /* 移除hover效果，优化触摸体验 */
  .product-card:hover {
    transform: none;
  }
  
  .linked-group-item:hover {
    transform: none;
  }
  
  /* 增大点击区域 */
  .product-card {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  }
  
  .back-button,
  .page-btn,
  .action-buttons button {
    min-height: 44px;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  }
  
  /* 优化滚动 */
  .product-linked-group-list {
    -webkit-overflow-scrolling: touch;
  }
  
  .size-price-table-container {
    -webkit-overflow-scrolling: touch;
  }
}

/* ========================================
   iPhone 安全区域适配
   ======================================== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .product-detail {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  
  .action-buttons {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  
  #fullPriceModal .modal-content {
    padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
  }
}

/* ========================================
   横屏模式适配
   ======================================== */
@media (max-width: 896px) and (orientation: landscape) {
  .product-detail {
    padding: 12px;
  }
  
  .detail-content {
    display: flex;
    flex-direction: row;
    gap: 20px;
  }
  
  .detail-left {
    flex: 0 0 40%;
    max-width: 40%;
  }
  
  .detail-right {
    flex: 1;
  }
  
  .main-image-container {
    max-height: 60vh;
  }
}

/* 交易记录区域样式 → 见 transaction-inline.css */
